﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using GSLMS.Core;
using GSLMS.Entity.Enum;
using GSLMS.Entity;

namespace GSLMS.WebAPP.Areas.DianDang.Controllers.FKApply.LoanApply
{
    public class LoanedApplyController : AdminBaseController
    {
        //
        // GET: /DianDang/LoanApply/

        public ActionResult Index(FormCollection form)
        {
            ViewData["Status"] = EnumHelper.ToSelectList<ApplyEnum.MainStatus>();
            var searchParma = SearchPara<TB_LOAN_MAIN>(form, new TB_LOAN_MAIN() { APPLYDATE = DateTime.Now.AddMonths(-1), APPLYDATE_END = DateTime.Now, LOANDATE = DateTime.Now.AddMonths(-1), LOANDATE_END = DateTime.Now });
            var list = serviceLoanMain.GetList(searchParma);
            ViewData["RowCount"] = searchParma.RowCount;

            return View(list);
        }

        //
        // GET: /DianDang/LoanApply/Details/5

        public ActionResult Details(int? id)
        {
            ViewData["LendorCorp"] = base.GetListFromDict("");
            ViewData["FinalApprover"] = base.GetListFromDict("");
            var model = new TB_LOAN_CONTRACT();
            if (id.HasValue && id > 0)
            {
                //model = serviceLoanContract.GetByID(id.Value);
                model = new TB_LOAN_CONTRACT() { ID = 1, CUSTNAME = "DDDDDDDD" };
            }
            return View(model);
        }

        //
        // GET: /DianDang/LoanApply/Create

        public ActionResult Create()
        {
            return View();
        }

        //
        // POST: /DianDang/LoanApply/Create

        [HttpPost]
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        //
        // GET: /DianDang/LoanApply/Edit/5

        public ActionResult Edit(int id)
        {
            return View();
        }

        //
        // POST: /DianDang/LoanApply/Edit/5

        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        //
        // GET: /DianDang/LoanApply/Delete/5

        public ActionResult Delete(int id)
        {
            return View();
        }

        //
        // POST: /DianDang/LoanApply/Delete/5

        [HttpPost]
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
    }
}
